Permalink
Browse files

Modify windows platform code to support x86_64 compilation

  • Loading branch information...
1 parent e154b1c commit 9db2962285c2d40e0e3eb291b330da698a733b87 @jamesu committed Mar 17, 2013
@@ -73,9 +73,19 @@ typedef unsigned _int64 U64;
# define TORQUE_SUPPORTS_NASM
# define TORQUE_SUPPORTS_VC_INLINE_X86_ASM
#else
+
+#if defined(_M_AMD64)
+# define TORQUE_CPU_STRING "x86_64"
+# define TORQUE_64
+# define TORQUE_LITTLE_ENDIAN
+//# define TORQUE_SUPPORTS_NASM
+//# define TORQUE_SUPPORTS_VC_INLINE_X86_ASM
+# else
# error "VC: Unsupported Target CPU"
#endif
+#endif
+
#define FN_CDECL __cdecl ///< Calling convention
@@ -29,7 +29,7 @@
// size_t is needed to overload new
// size_t tends to be OS and compiler specific and may need to
// be if/def'ed in the future
-typedef unsigned int dsize_t;
+typedef size_t dsize_t;
/** Platform dependent file date-time structure. The defination of this structure
@@ -112,7 +112,11 @@ static UINT_PTR CALLBACK FolderHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPA
SendMessage(hParent, CDM_HIDECONTROL, cmb1, 0);
SendMessage(hParent, CDM_HIDECONTROL, stc2, 0);
+#ifdef _WIN64
+ LONG oldProc = SetWindowLongPtr(hParent, GWLP_WNDPROC, (LONG_PTR)OKBtnFolderHackProc);
+#else
LONG oldProc = SetWindowLong(hParent, GWL_WNDPROC, (LONG)OKBtnFolderHackProc);
+#endif
SetProp(hParent, dT("OldWndProc"), (HANDLE)oldProc);
SetProp(hParent, dT("OFN"), (HANDLE)lpofn);
}
@@ -55,7 +55,7 @@ class WinFont : public PlatformFont
virtual PlatformFont::CharInfo &getCharInfo(const UTF16 ch) const;
virtual PlatformFont::CharInfo &getCharInfo(const UTF8 *str) const;
- virtual bool create(const char *name, dsize_t size, U32 charset = TGE_ANSI_CHARSET);
+ virtual bool create(const char *name, U32 size, U32 charset = TGE_ANSI_CHARSET);
};
#endif // _WINFONT_H_
@@ -38,28 +38,28 @@ void dRealFree(void* p)
//-----------------------------------------------------------------------------
-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);
}
@@ -312,7 +312,7 @@ S32 dVprintf(const char *format, va_list arglist)
return (len);
}
-S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
+S32 dSprintf(char *buffer, dsize_t bufferSize, const char *format, ...)
{
va_list args;
va_start(args, format);
@@ -325,7 +325,7 @@ S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
}
-S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, va_list arglist)
+S32 dVsprintf(char *buffer, dsize_t bufferSize, const char *format, va_list arglist)
{
S32 len = vsnprintf(buffer, bufferSize, format, arglist);
@@ -24,7 +24,10 @@
#include "console/console.h"
#include "string/stringTable.h"
+#ifndef _WIN64
typedef long SHANDLE_PTR;
+#endif
+
#include <shlobj.h>
#include <windows.h>
#include <lmcons.h>

0 comments on commit 9db2962

Please sign in to comment.