From 3eecc1de5300dd93fa279dff66760ee4c51b8a8f Mon Sep 17 00:00:00 2001 From: James Lacey Date: Wed, 22 Aug 2012 14:25:31 -0700 Subject: [PATCH] Builds for x64 on Visual Studio 2010. Still need to go through, evaluate and fix all the 64-bit truncation warnings. --- .../ClientShellShared/GameClientShell.cpp | 8 ++-- .../ClientShellShared/PlayerMgr.cpp | 5 +-- NOLF2/ObjectDLL/ObjectShared/KeyFramer.cpp | 2 +- NOLF2/Shared/UberAssert.h | 12 +++--- NOLF2/Shared/stacktrace.cpp | 20 +++++++++- NOLF2/Shared/stacktrace.h | 28 +++++++++++++- libs/WONAPI/WONMisc/MediaMetrix.cpp | 2 +- libs/ltmem/ltmemtrack.cpp | 4 +- runtime/client/CMakeLists.txt | 8 +++- .../client/src/sys/win/customfontfilemgr.cpp | 4 +- runtime/kernel/mem/src/de_memory.h | 4 +- runtime/kernel/mem/src/sys/win/de_memory.cpp | 4 +- runtime/kernel/src/sys/win/client.cpp | 2 +- runtime/render_a/src/sys/d3d/FixedPoint.h | 19 +++++++++- runtime/render_a/src/sys/d3d/common_draw.h | 2 + runtime/render_a/src/sys/d3d/common_stuff.h | 4 +- runtime/shared/src/concommand.h | 2 +- runtime/shared/src/dhashtable.cpp | 2 +- runtime/shared/src/stacktrace.cpp | 23 ++++++++++- runtime/shared/src/stacktrace.h | 38 ++++++++++++++++++- runtime/sound/src/iltsound.h | 3 ++ runtime/sound/src/soundmgr.cpp | 2 + runtime/sound/src/sys/s_dx8/CMakeLists.txt | 12 +++++- runtime/sound/src/sys/s_dx8/s_dx8.cpp | 13 ++++--- sdk/inc/iltsoundmgr.h | 2 + sdk/inc/ltbasedefs.h | 12 +++--- sdk/inc/ltmodule.h | 2 +- 27 files changed, 190 insertions(+), 49 deletions(-) diff --git a/NOLF2/ClientShellDLL/ClientShellShared/GameClientShell.cpp b/NOLF2/ClientShellDLL/ClientShellShared/GameClientShell.cpp index e583ec62..a7038a12 100644 --- a/NOLF2/ClientShellDLL/ClientShellShared/GameClientShell.cpp +++ b/NOLF2/ClientShellDLL/ClientShellShared/GameClientShell.cpp @@ -4603,9 +4603,9 @@ BOOL HookWindow() // Get the window procedure #ifdef STRICT - g_pfnMainWndProc = (WNDPROC)GetWindowLong(g_hMainWnd,GWL_WNDPROC); + g_pfnMainWndProc = (WNDPROC)GetWindowLongPtr(g_hMainWnd,GWLP_WNDPROC); #else - g_pfnMainWndProc = (FARPROC)GetWindowLong(g_hMainWnd,GWL_WNDPROC); + g_pfnMainWndProc = (FARPROC)GetWindowLongPtr(g_hMainWnd,GWLP_WNDPROC); #endif if(!g_pfnMainWndProc) @@ -4615,7 +4615,7 @@ BOOL HookWindow() } // Replace it with ours - if(!SetWindowLong(g_hMainWnd,GWL_WNDPROC,(LONG)HookedWindowProc)) + if(!SetWindowLongPtr(g_hMainWnd,GWLP_WNDPROC, (LONG_PTR)HookedWindowProc)) { TRACE("HookWindow - ERROR - could not set the window procedure!\n"); return FALSE; @@ -4636,7 +4636,7 @@ void UnhookWindow() { if(g_pfnMainWndProc && g_hMainWnd) { - SetWindowLong(g_hMainWnd, GWL_WNDPROC, (LONG)g_pfnMainWndProc); + SetWindowLongPtr(g_hMainWnd, GWLP_WNDPROC, (LONG_PTR)g_pfnMainWndProc); g_hMainWnd = 0; g_pfnMainWndProc = NULL; } diff --git a/NOLF2/ClientShellDLL/ClientShellShared/PlayerMgr.cpp b/NOLF2/ClientShellDLL/ClientShellShared/PlayerMgr.cpp index d3b30662..debb9bfa 100644 --- a/NOLF2/ClientShellDLL/ClientShellShared/PlayerMgr.cpp +++ b/NOLF2/ClientShellDLL/ClientShellShared/PlayerMgr.cpp @@ -4865,8 +4865,7 @@ void CPlayerMgr::UpdateSoundFilters(uint8 nSoundFilterId) { #ifndef USE_EAX20_HARDWARE_FILTERS return; -#endif // USE_EAX20_HARDWARE_FILTERS - +#else if (g_vtUseSoundFilters.GetFloat()) { if ( m_nSoundFilterId != nSoundFilterId ) @@ -4931,7 +4930,7 @@ void CPlayerMgr::UpdateSoundFilters(uint8 nSoundFilterId) } } - +#endif // USE_EAX20_HARDWARE_FILTERS } diff --git a/NOLF2/ObjectDLL/ObjectShared/KeyFramer.cpp b/NOLF2/ObjectDLL/ObjectShared/KeyFramer.cpp index a6823302..d586acd6 100644 --- a/NOLF2/ObjectDLL/ObjectShared/KeyFramer.cpp +++ b/NOLF2/ObjectDLL/ObjectShared/KeyFramer.cpp @@ -2509,7 +2509,7 @@ void KeyFramer::Load(ILTMessage_Read *pMsg, uint32 dwLoadFlags) HOBJECT* hObjectArray = debug_newa(HOBJECT, nNumInList); HOBJECT hObj = LTNULL; - for (int i=0; i < nNumInList; i++) + for (i=0; i < nNumInList; i++) { LOAD_HOBJECT(hObj); if (hObj) diff --git a/NOLF2/Shared/UberAssert.h b/NOLF2/Shared/UberAssert.h index 88688cf7..025a0b30 100644 --- a/NOLF2/Shared/UberAssert.h +++ b/NOLF2/Shared/UberAssert.h @@ -24,7 +24,7 @@ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, description )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } @@ -34,35 +34,35 @@ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, desc, d1 )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } #define UBER_ASSERT2( exp, desc, d1, d2 ) \ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, desc, d1, d2 )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } #define UBER_ASSERT3( exp, desc, d1, d2, d3 ) \ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, desc, d1, d2, d3 )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } #define UBER_ASSERT4( exp, desc, d1, d2, d3, d4 ) \ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, desc, d1, d2, d3, d4 )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } #define UBER_ASSERT5( exp, desc, d1, d2, d3, d4, d5 ) \ if ( !(exp) ) { \ if( UberAssert( __LINE__, __FILE__, #exp, desc, d1, d2, d3, d4, d5 )) \ { \ - _asm { int 3 } \ + __debugbreak(); \ } \ } diff --git a/NOLF2/Shared/stacktrace.cpp b/NOLF2/Shared/stacktrace.cpp index be93c092..3f1cc71b 100644 --- a/NOLF2/Shared/stacktrace.cpp +++ b/NOLF2/Shared/stacktrace.cpp @@ -37,7 +37,11 @@ static CSymbolEngine g_cSym ; // If TRUE, the symbol engine has been initialized. static BOOL g_bSymIsInit = FALSE ; +#ifdef _M_IX86 static DWORD __stdcall GetModBase ( HANDLE hProcess , DWORD dwAddr ) +#else +static DWORD64 __stdcall GetModBase ( HANDLE hProcess , DWORD64 dwAddr ) +#endif { // Check in the symbol engine first. IMAGEHLP_MODULE stIHM ; @@ -134,7 +138,11 @@ static DWORD ConvertAddress ( DWORD dwAddr , LPTSTR szOutBuff ) } // Get the function. +#ifdef _M_IX86 DWORD dwDisp ; +#else + DWORD64 dwDisp ; +#endif if ( 0 != g_cSym.SymGetSymFromAddr ( dwAddr , &dwDisp , pIHS ) ) { pCurrPos += wsprintf ( pCurrPos , _T ( "%s() " ) , pIHS->Name); @@ -147,7 +155,7 @@ static DWORD ConvertAddress ( DWORD dwAddr , LPTSTR szOutBuff ) stIHL.SizeOfStruct = sizeof ( IMAGEHLP_LINE ) ; if ( 0 != g_cSym.SymGetLineFromAddr ( dwAddr , - &dwDisp , + (PDWORD)&dwDisp , &stIHL ) ) { // Put this on the next line and indented a bit. @@ -223,11 +231,21 @@ void DoStackTrace ( LPTSTR szString , stFrame.AddrPC.Mode = AddrModeFlat ; +#ifdef _M_IX86 dwMachine = IMAGE_FILE_MACHINE_I386 ; stFrame.AddrPC.Offset = stCtx.Eip ; stFrame.AddrStack.Offset = stCtx.Esp ; +#else + dwMachine = IMAGE_FILE_MACHINE_AMD64 ; + stFrame.AddrPC.Offset = stCtx.Rip ; + stFrame.AddrStack.Offset = stCtx.Rsp ; +#endif stFrame.AddrStack.Mode = AddrModeFlat ; +#ifdef _M_IX86 stFrame.AddrFrame.Offset = stCtx.Ebp ; +#else + stFrame.AddrFrame.Offset = stCtx.Rbp ; +#endif stFrame.AddrFrame.Mode = AddrModeFlat ; // Loop for the first 512 stack elements. diff --git a/NOLF2/Shared/stacktrace.h b/NOLF2/Shared/stacktrace.h index 46b3e5e3..dc5a424e 100644 --- a/NOLF2/Shared/stacktrace.h +++ b/NOLF2/Shared/stacktrace.h @@ -59,6 +59,10 @@ DO_NOT_WORK_AROUND_SRCLINE_BUG - Define this to NOT work around the lookups fail after the first lookup. ----------------------------------------------------------------------*/ +#ifdef _M_X64 +#define _IMAGEHLP64 +#endif + #include "imagehlp.h" #include @@ -213,12 +217,22 @@ struct CImageHlp_Line : public IMAGEHLP_LINE } ; // Typedefs for the new source and line functions. +#ifdef _M_IX86 typedef BOOL (__stdcall *PFNSYMGETLINEFROMADDR) ( IN HANDLE hProcess , IN DWORD dwAddr , OUT PDWORD pdwDisplacement , OUT PIMAGEHLP_LINE Line ) ; +#else +typedef +BOOL (__stdcall *PFNSYMGETLINEFROMADDR) + ( IN HANDLE hProcess , + IN DWORD64 dwAddr , + OUT PDWORD pdwDisplacement , + OUT PIMAGEHLP_LINE64 Line ) ; +#endif + typedef BOOL (__stdcall *PFNSYMGETLINEFROMNAME) ( IN HANDLE hProcess , @@ -472,9 +486,15 @@ public : UserContext ) ) ; } +#ifdef _M_IX86 BOOL SymGetSymFromAddr ( IN DWORD dwAddr , OUT PDWORD pdwDisplacement , OUT PIMAGEHLP_SYMBOL Symbol ) +#else + BOOL SymGetSymFromAddr ( IN DWORD dwAddr , + OUT PDWORD64 pdwDisplacement , + OUT PIMAGEHLP_SYMBOL Symbol ) +#endif { return ( ::SymGetSymFromAddr ( m_hProcess , dwAddr , @@ -659,9 +679,15 @@ public : return ( :: SymSetSearchPath ( m_hProcess , SearchPath ) ) ; } +#ifdef _M_IX86 BOOL SymRegisterCallback ( IN PSYMBOL_REGISTERED_CALLBACK CallbackFunction, - IN PVOID UserContext ) + IN PVOID UserContext ) +#else + BOOL SymRegisterCallback ( IN PSYMBOL_REGISTERED_CALLBACK + CallbackFunction, + IN ULONG64 UserContext ) +#endif { return ( ::SymRegisterCallback ( m_hProcess , CallbackFunction , diff --git a/libs/WONAPI/WONMisc/MediaMetrix.cpp b/libs/WONAPI/WONMisc/MediaMetrix.cpp index dbd3ac03..0fc534ae 100644 --- a/libs/WONAPI/WONMisc/MediaMetrix.cpp +++ b/libs/WONAPI/WONMisc/MediaMetrix.cpp @@ -17,7 +17,7 @@ void CreateMediaMetrixEditControl(HWND theParent) 0, 0, 100, 50, // arbitrary size theParent, // parent window (HMENU) NULL, // edit control ID - (HINSTANCE) GetWindowLong(theParent, GWL_HINSTANCE), + (HINSTANCE) GetWindowLongPtr(theParent, GWLP_HINSTANCE), NULL); // pointer not needed } diff --git a/libs/ltmem/ltmemtrack.cpp b/libs/ltmem/ltmemtrack.cpp index 30b6c257..206ae6b4 100644 --- a/libs/ltmem/ltmemtrack.cpp +++ b/libs/ltmem/ltmemtrack.cpp @@ -174,8 +174,8 @@ void LTMemTrackAllocStart(unsigned int nLineNum, const char* sFileName, unsigned g_curAllocInfo.m_sFileName[0] = '\0'; else { - uint32 nStrLen = strlen(sFileName); - uint32 nOffset = 0; + size_t nStrLen = strlen(sFileName); + size_t nOffset = 0; if (nStrLen >= CMEMTRACKFILENAMESIZE) nOffset = nStrLen - CMEMTRACKFILENAMESIZE + 1; strncpy(g_curAllocInfo.m_sFileName, sFileName + nOffset, CMEMTRACKFILENAMESIZE); g_curAllocInfo.m_sFileName[CMEMTRACKFILENAMESIZE-1] = '\0'; diff --git a/runtime/client/CMakeLists.txt b/runtime/client/CMakeLists.txt index feccce22..d74fa682 100644 --- a/runtime/client/CMakeLists.txt +++ b/runtime/client/CMakeLists.txt @@ -2,8 +2,12 @@ cmake_minimum_required (VERSION 2.8) project (EXE_Lithtech) add_definitions(-DDE_LOCAL_SERVERBIND -DDE_CLIENT_COMPILE -DDSNDMGR_NO_MFC -DDIRECTENGINE_COMPILE -DMODEL_SUPPORT_ABC) -link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x86") - +if(CMAKE_CL_64) + link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x64") +else(CMAKE_CL_64) + link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x86") +endif(CMAKE_CL_64) + add_executable (EXE_Lithtech WIN32 ../controlfilemgr/controlfilemgr.cpp src/client_filemgr.cpp diff --git a/runtime/client/src/sys/win/customfontfilemgr.cpp b/runtime/client/src/sys/win/customfontfilemgr.cpp index f0967571..ed121edc 100644 --- a/runtime/client/src/sys/win/customfontfilemgr.cpp +++ b/runtime/client/src/sys/win/customfontfilemgr.cpp @@ -22,8 +22,8 @@ define_holder(IClientFileMgr, client_filemgr); static void BroadcastFontChangeMessage() { static const uint32 knTimeoutMS = 30; - DWORD nResult; - SendMessageTimeout(HWND_BROADCAST, WM_FONTCHANGE, (WPARAM)0, (LPARAM)0, SMTO_ABORTIFHUNG | SMTO_BLOCK, knTimeoutMS, &nResult); + PDWORD_PTR nResult; + SendMessageTimeout(HWND_BROADCAST, WM_FONTCHANGE, (WPARAM)0, (LPARAM)0, SMTO_ABORTIFHUNG | SMTO_BLOCK, knTimeoutMS, nResult); } //------------------------------------------- diff --git a/runtime/kernel/mem/src/de_memory.h b/runtime/kernel/mem/src/de_memory.h index 7ec83343..2e0fc1f6 100644 --- a/runtime/kernel/mem/src/de_memory.h +++ b/runtime/kernel/mem/src/de_memory.h @@ -24,8 +24,8 @@ uint32 dm_GetNumAllocations(); extern void* operator new(size_t size, void *ptr, char z); // C dalloc/dfree functions. -void* dalloc(uint32 size); -void* dalloc_z(uint32 size); // Allocate and zero-init. +void* dalloc(size_t size); +void* dalloc_z(size_t size); // Allocate and zero-init. void dfree(void *ptr); diff --git a/runtime/kernel/mem/src/sys/win/de_memory.cpp b/runtime/kernel/mem/src/sys/win/de_memory.cpp index 17f56812..eee42fc4 100644 --- a/runtime/kernel/mem/src/sys/win/de_memory.cpp +++ b/runtime/kernel/mem/src/sys/win/de_memory.cpp @@ -117,7 +117,7 @@ uint32 dm_GetNumAllocations() return g_nAllocations; } -void* dalloc(uint32 size) +void* dalloc(size_t size) { //[DLK] Removed to avoid allocation errors with D3DXEffectCompiler /* @@ -166,7 +166,7 @@ void* dalloc(uint32 size) } -void* dalloc_z(uint32 size) +void* dalloc_z(size_t size) { void *ret; diff --git a/runtime/kernel/src/sys/win/client.cpp b/runtime/kernel/src/sys/win/client.cpp index 2a1066e2..c66e8bb5 100644 --- a/runtime/kernel/src/sys/win/client.cpp +++ b/runtime/kernel/src/sys/win/client.cpp @@ -173,7 +173,7 @@ static bool StartClient(ClientGlob *pGlob) } -static long WINAPI MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { +static LRESULT WINAPI MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { ClientGlob *pGlob; char messageString[256], fileName[_MAX_PATH + 1]; int i; diff --git a/runtime/render_a/src/sys/d3d/FixedPoint.h b/runtime/render_a/src/sys/d3d/FixedPoint.h index 21d110b6..3811d9ab 100644 --- a/runtime/render_a/src/sys/d3d/FixedPoint.h +++ b/runtime/render_a/src/sys/d3d/FixedPoint.h @@ -5,15 +5,32 @@ // The original code was written by Chris Hecker (checker@netcom.com). Additional // modifications by Scott H. Pultz +#ifndef _M_IX86 +#ifdef _MSC_VER +// From http://opensource.apple.com/source/JavaScriptCore/JavaScriptCore-621.1/wtf/MathExtras.h +inline float roundf(float num) +{ + float integer = ceilf(num); + if (num > 0) + return integer - num > 0.5f ? integer - 1.0f : integer; + return integer - num >= 0.5f ? integer - 1.0f : integer; +} +inline long lroundf(float num) { return static_cast(roundf(num)); } +#endif +#endif + inline int RoundFloatToInt(float f) { int nResult; - +#ifdef _M_IX86 __asm { fld f fistp nResult } +#else + nResult = lroundf(f); +#endif return nResult; } diff --git a/runtime/render_a/src/sys/d3d/common_draw.h b/runtime/render_a/src/sys/d3d/common_draw.h index 648f9198..3256466f 100644 --- a/runtime/render_a/src/sys/d3d/common_draw.h +++ b/runtime/render_a/src/sys/d3d/common_draw.h @@ -77,6 +77,7 @@ void d3d_IncrementFrameCode(RenderContext *pContext); inline void d3d_SetFPState() { +#ifdef _M_IX86 short control; _asm { @@ -84,6 +85,7 @@ inline void d3d_SetFPState() and control, 0xfcff // PC field = 00 for single precision fldcw control } +#endif } #endif // __COMMON_DRAW_H__ diff --git a/runtime/render_a/src/sys/d3d/common_stuff.h b/runtime/render_a/src/sys/d3d/common_stuff.h index 1075a962..aa23d955 100644 --- a/runtime/render_a/src/sys/d3d/common_stuff.h +++ b/runtime/render_a/src/sys/d3d/common_stuff.h @@ -26,8 +26,8 @@ extern RenderStruct* g_pStruct; extern uint32 g_ScreenWidth, g_ScreenHeight; extern HWND g_hWnd; -void* dalloc(unsigned long size); -void* dalloc_z(unsigned long size); +void* dalloc(size_t size); +void* dalloc_z(size_t size); void dfree(void *ptr); void AddDebugMessage(uint32 debugLevel, const char *pMsg, ...); void d3d_CreateConsoleVariables(); diff --git a/runtime/shared/src/concommand.h b/runtime/shared/src/concommand.h index f24f5c27..3f6f405c 100644 --- a/runtime/shared/src/concommand.h +++ b/runtime/shared/src/concommand.h @@ -102,7 +102,7 @@ struct ConsoleState void (*ConsolePrint)(const char *pMsg, ...); // Function to allocate/free memory. - void* (*Alloc)(uint32 size); + void* (*Alloc)(size_t size); void (*Free)(void *ptr); // Called when a variable is added. diff --git a/runtime/shared/src/dhashtable.cpp b/runtime/shared/src/dhashtable.cpp index c2f64a95..6281b03b 100644 --- a/runtime/shared/src/dhashtable.cpp +++ b/runtime/shared/src/dhashtable.cpp @@ -2,7 +2,7 @@ #include "bdefs.h" #include "dhashtable.h" -extern void* dalloc(uint32 size); +extern void* dalloc(size_t size); extern void dfree(void *ptr); diff --git a/runtime/shared/src/stacktrace.cpp b/runtime/shared/src/stacktrace.cpp index 0d0ca8d2..da43afde 100644 --- a/runtime/shared/src/stacktrace.cpp +++ b/runtime/shared/src/stacktrace.cpp @@ -40,7 +40,11 @@ static CSymbolEngine g_cSym ; // If TRUE, the symbol engine has been initialized. static BOOL g_bSymIsInit = FALSE ; +#ifdef _M_IX86 static DWORD __stdcall GetModBase ( HANDLE hProcess , DWORD dwAddr ) +#else +static DWORD64 __stdcall GetModBase ( HANDLE hProcess , DWORD64 dwAddr ) +#endif { // Check in the symbol engine first. IMAGEHLP_MODULE stIHM ; @@ -137,7 +141,11 @@ static DWORD ConvertAddress ( DWORD dwAddr , LPTSTR szOutBuff ) } // Get the function. +#ifdef _M_IX86 DWORD dwDisp ; +#else + DWORD64 dwDisp ; +#endif if ( 0 != g_cSym.SymGetSymFromAddr ( dwAddr , &dwDisp , pIHS ) ) { pCurrPos += wsprintf ( pCurrPos , _T ( "%s() " ) , pIHS->Name); @@ -150,7 +158,7 @@ static DWORD ConvertAddress ( DWORD dwAddr , LPTSTR szOutBuff ) stIHL.SizeOfStruct = sizeof ( IMAGEHLP_LINE ) ; if ( 0 != g_cSym.SymGetLineFromAddr ( dwAddr , - &dwDisp , + (PDWORD)&dwDisp , &stIHL ) ) { // Put this on the next line and indented a bit. @@ -226,11 +234,24 @@ void DoStackTrace ( LPTSTR szString , stFrame.AddrPC.Mode = AddrModeFlat ; +#ifdef _M_IX86 dwMachine = IMAGE_FILE_MACHINE_I386 ; +#else + dwMachine = IMAGE_FILE_MACHINE_AMD64; +#endif +#ifdef _M_IX86 stFrame.AddrPC.Offset = stCtx.Eip ; stFrame.AddrStack.Offset = stCtx.Esp ; +#else + stFrame.AddrPC.Offset = stCtx.Rip ; + stFrame.AddrStack.Offset = stCtx.Rsp ; +#endif stFrame.AddrStack.Mode = AddrModeFlat ; +#ifdef _M_IX86 stFrame.AddrFrame.Offset = stCtx.Ebp ; +#else + stFrame.AddrFrame.Offset = stCtx.Rbp ; +#endif stFrame.AddrFrame.Mode = AddrModeFlat ; // Loop for the first 512 stack elements. diff --git a/runtime/shared/src/stacktrace.h b/runtime/shared/src/stacktrace.h index 46b3e5e3..860634c8 100644 --- a/runtime/shared/src/stacktrace.h +++ b/runtime/shared/src/stacktrace.h @@ -59,6 +59,10 @@ DO_NOT_WORK_AROUND_SRCLINE_BUG - Define this to NOT work around the lookups fail after the first lookup. ----------------------------------------------------------------------*/ +#ifdef _M_X64 +#define _IMAGEHLP64 +#endif + #include "imagehlp.h" #include @@ -213,12 +217,22 @@ struct CImageHlp_Line : public IMAGEHLP_LINE } ; // Typedefs for the new source and line functions. +#ifdef _M_IX86 typedef BOOL (__stdcall *PFNSYMGETLINEFROMADDR) ( IN HANDLE hProcess , IN DWORD dwAddr , OUT PDWORD pdwDisplacement , OUT PIMAGEHLP_LINE Line ) ; +#else +typedef +BOOL (__stdcall *PFNSYMGETLINEFROMADDR) + ( IN HANDLE hProcess , + IN DWORD64 dwAddr , + OUT PDWORD pdwDisplacement , + OUT PIMAGEHLP_LINE64 Line ) ; +#endif + typedef BOOL (__stdcall *PFNSYMGETLINEFROMNAME) ( IN HANDLE hProcess , @@ -472,6 +486,7 @@ public : UserContext ) ) ; } +#ifdef _M_IX86 BOOL SymGetSymFromAddr ( IN DWORD dwAddr , OUT PDWORD pdwDisplacement , OUT PIMAGEHLP_SYMBOL Symbol ) @@ -481,6 +496,17 @@ public : pdwDisplacement , Symbol ) ) ; } +#else + BOOL SymGetSymFromAddr ( IN DWORD dwAddr , + OUT PDWORD64 pdwDisplacement , + OUT PIMAGEHLP_SYMBOL Symbol ) + { + return ( ::SymGetSymFromAddr ( m_hProcess , + dwAddr , + pdwDisplacement , + Symbol ) ) ; + } +#endif BOOL SymGetSymFromName ( IN LPSTR Name , OUT PIMAGEHLP_SYMBOL Symbol ) @@ -659,6 +685,7 @@ public : return ( :: SymSetSearchPath ( m_hProcess , SearchPath ) ) ; } +#ifdef _M_IX86 BOOL SymRegisterCallback ( IN PSYMBOL_REGISTERED_CALLBACK CallbackFunction, IN PVOID UserContext ) @@ -667,7 +694,16 @@ public : CallbackFunction , UserContext ) ) ; } - +#else + BOOL SymRegisterCallback ( IN PSYMBOL_REGISTERED_CALLBACK + CallbackFunction, + IN ULONG64 UserContext ) + { + return ( ::SymRegisterCallback ( m_hProcess , + CallbackFunction , + UserContext ) ) ; + } +#endif /*---------------------------------------------------------------------- Protected Data Members diff --git a/runtime/sound/src/iltsound.h b/runtime/sound/src/iltsound.h index 1ec1ddc6..42fe19fd 100644 --- a/runtime/sound/src/iltsound.h +++ b/runtime/sound/src/iltsound.h @@ -42,9 +42,12 @@ // Uncomment one of these to use filtering, only one can be active //#define USE_DX8_SOFTWARE_FILTERS +// We don't have the EAX library for x64 and USE_DX8_SOFTWARE_FILTERS seems to be broken too +#ifdef _M_IX8 #ifndef USE_EAX20_HARDWARE_FILTERS #define USE_EAX20_HARDWARE_FILTERS #endif +#endif typedef short sint16; //S16; typedef unsigned short uint16; //U16; diff --git a/runtime/sound/src/soundmgr.cpp b/runtime/sound/src/soundmgr.cpp index 27ae51a1..54ab258a 100644 --- a/runtime/sound/src/soundmgr.cpp +++ b/runtime/sound/src/soundmgr.cpp @@ -228,9 +228,11 @@ CSoundMgr::CSoundMgr() m_abUseGlobalVolume[i] = true; } +#ifdef USE_EAX20_HARDWARE_FILTERS m_FilterData.bUseFilter = false; m_FilterData.pSoundFilter = NULL; m_FilterData.uiFilterType = NULL_FILTER; +#endif memset(&m_PrimaryBufferWaveFormat, 0, sizeof(m_PrimaryBufferWaveFormat)); } diff --git a/runtime/sound/src/sys/s_dx8/CMakeLists.txt b/runtime/sound/src/sys/s_dx8/CMakeLists.txt index 1e64bd63..c2c07e7f 100644 --- a/runtime/sound/src/sys/s_dx8/CMakeLists.txt +++ b/runtime/sound/src/sys/s_dx8/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required (VERSION 2.8) project (DLL_dx8) -link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x86") +if(CMAKE_CL_64) + link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x64") +else(CMAKE_CL_64) + link_directories("C:\\Program Files (x86)\\Microsoft DirectX SDK (February 2006)\\Lib\\x86") +endif(CMAKE_CL_64) + add_library (DLL_dx8 SHARED ../../../../kernel/src/sys/win/counter.cpp parsewavefile.cpp @@ -17,6 +22,9 @@ target_link_libraries(DLL_dx8 dxguid winmm msacm32 - eaxguid ltmem) + +if(NOT CMAKE_CL_64) + target_link_libraries(DLL_dx8 eaxguid) +endif(NOT CMAKE_CL_64) \ No newline at end of file diff --git a/runtime/sound/src/sys/s_dx8/s_dx8.cpp b/runtime/sound/src/sys/s_dx8/s_dx8.cpp index d56f2323..1538d090 100644 --- a/runtime/sound/src/sys/s_dx8/s_dx8.cpp +++ b/runtime/sound/src/sys/s_dx8/s_dx8.cpp @@ -2140,10 +2140,10 @@ void CDx8SoundSys::Reset( ) m_dwMinHardwareBuffers = 0; #ifdef USE_EAX20_HARDWARE_FILTERS m_bSupportsEAX20Filtering = false; + g_iCurrentEAXDirectSetting = 0; #endif m_pKSPropertySet = NULL; - g_iCurrentEAXDirectSetting = 0; - + m_cEvent_SampleLoopActive.Clear(); m_cEvent_StreamingActive.Clear(); m_cEvent_Shutdown.Clear(); @@ -2477,7 +2477,7 @@ struct FormatEnumProcData static BOOL CALLBACK FormatEnumProc( HACMDRIVERID hadid, LPACMFORMATDETAILS pafd, - DWORD dwInstance, + DWORD_PTR dwInstance, DWORD fdwSupport ) { @@ -2557,7 +2557,7 @@ struct SDriverEnumInfo TSupportFlagsList m_aSupportFlags; }; -BOOL CALLBACK AcmDriverEnumProc( HACMDRIVERID hDriverId, unsigned long uiInstanceData, unsigned long uiSupportFlags ) +BOOL CALLBACK AcmDriverEnumProc( HACMDRIVERID hDriverId, DWORD_PTR uiInstanceData, DWORD uiSupportFlags ) { // Add the driver to our list SDriverEnumInfo *cEnumInfo = reinterpret_cast( uiInstanceData ); @@ -2911,7 +2911,6 @@ S32 CDx8SoundSys::Startup( void ) m_hAcmMP3DriverId == NULL || m_hAcmPCMDriverId == NULL ) { - mmResult = acmDriverEnum( AcmDriverEnumProc, ( uint32 )&sEnumResults, 0 ); if( mmResult != 0 ) return LS_ERROR; @@ -3645,7 +3644,11 @@ LH3DSAMPLE CDx8SoundSys::Allocate3DSampleHandle( LHPROVIDER hLib ) // Make sure we have our propertyset interface setup. +#ifdef USE_EAX20_HARDWARE_FILTERS if( m_bSupportsEAX20Filtering && !m_pKSPropertySet ) +#else + if( !m_pKSPropertySet ) +#endif { HRESULT hRes = p3DSample->m_sample.m_pDSBuffer->QueryInterface( IID_IKsPropertySet, ( LPVOID* )&m_pKSPropertySet ); if( FAILED( hRes )) diff --git a/sdk/inc/iltsoundmgr.h b/sdk/inc/iltsoundmgr.h index 2d28aaa5..db452606 100644 --- a/sdk/inc/iltsoundmgr.h +++ b/sdk/inc/iltsoundmgr.h @@ -10,9 +10,11 @@ // uncomment one of these for filter support // #define USE_DX8_SOFTWARE_FILTERS +#ifdef _M_IX86 #ifndef USE_EAX20_HARDWARE_FILTERS #define USE_EAX20_HARDWARE_FILTERS #endif +#endif /*! Base sound mgr interface. (shared between client and server) */ diff --git a/sdk/inc/ltbasedefs.h b/sdk/inc/ltbasedefs.h index 6a5f4475..e98044f2 100644 --- a/sdk/inc/ltbasedefs.h +++ b/sdk/inc/ltbasedefs.h @@ -263,13 +263,13 @@ inline void LTStrnCpy(char* pDest, const char* pSrc, uint32 destBytes, uint32 sr /*! Safe string concatenation (strncat doesn't always null terminate, but this does). */ -inline void LTStrCat(char *pDest, const char *pSrc, uint32 destBytes) +inline void LTStrCat(char *pDest, const char *pSrc, size_t destBytes) { if (destBytes == 0) return; - uint32 destLen = strlen(pDest); - uint32 catLen = destBytes - destLen - 1; + size_t destLen = strlen(pDest); + size_t catLen = destBytes - destLen - 1; #ifndef _FINAL // do a sanity check to make sure we don't truncate source's data. @@ -316,13 +316,13 @@ inline void LTStrCat(wchar_t *pDest, const wchar_t *pSrc, uint32 nBufferChars) /*! Safe substring concatenation (strncat doesn't always terminate, but this does). */ -inline void LTStrnCat(char* pDest, const char* pSrc, uint32 destBytes, uint32 srcLen) +inline void LTStrnCat(char* pDest, const char* pSrc, size_t destBytes, size_t srcLen) { if( destBytes == 0 ) return; - uint32 destLen = strlen(pDest); - uint32 catLen = ((destBytes - destLen) <= srcLen) ? (destBytes-destLen-1) : srcLen; + size_t destLen = strlen(pDest); + size_t catLen = ((destBytes - destLen) <= srcLen) ? (destBytes-destLen-1) : srcLen; #ifndef _FINAL // do a sanity check to make sure we don't truncate source's data. diff --git a/sdk/inc/ltmodule.h b/sdk/inc/ltmodule.h index c08e6ed4..2d6ea9c6 100644 --- a/sdk/inc/ltmodule.h +++ b/sdk/inc/ltmodule.h @@ -1008,7 +1008,7 @@ int32 CAPIHolderBase::Version() { #if defined(__LINUX) #define BREAK1() #else - #define BREAK1() __asm {int 3} + #define BREAK1() __debugbreak() #endif #define BREAK(expression) if (expression) {BREAK1();} #else