diff --git a/neo/idlib/BitMsg.h b/neo/idlib/BitMsg.h index e853bf7c..2733b4a5 100644 --- a/neo/idlib/BitMsg.h +++ b/neo/idlib/BitMsg.h @@ -85,7 +85,8 @@ public: void WriteShort( int c ); void WriteUShort( int c ); void WriteInt( int c ); - void WriteFloat( float f ); + void WriteInt64(int64_t c); + void WriteFloat( float f ); void WriteFloat( float f, int exponentBits, int mantissaBits ); void WriteAngle8( float f ); void WriteAngle16( float f ); @@ -114,6 +115,7 @@ public: int ReadShort( void ) const; int ReadUShort( void ) const; int ReadInt( void ) const; + int64_t ReadInt64( void ) const; float ReadFloat( void ) const; float ReadFloat( int exponentBits, int mantissaBits ) const; float ReadAngle8( void ) const; @@ -300,6 +302,13 @@ ID_INLINE void idBitMsg::WriteInt( int c ) { WriteBits( c, 32 ); } +ID_INLINE void idBitMsg::WriteInt64(int64_t c) { + uint64_t uc = c; + + WriteBits(uc & 0xFFFFFFFF, 32); + WriteBits((uc >> 32) & 0xFFFFFFFF, 32); +} + ID_INLINE void idBitMsg::WriteFloat( float f ) { WriteBits( *reinterpret_cast(&f), 32 ); } @@ -380,6 +389,15 @@ ID_INLINE int idBitMsg::ReadInt( void ) const { return ReadBits( 32 ); } +ID_INLINE int64_t idBitMsg::ReadInt64(void) const { + uint32_t uc1, uc2; + + uc1 = ReadBits(32); + uc2 = ReadBits(32); + + return (uint64_t)uc1 | (uint64_t)uc2 << 32; +} + ID_INLINE float idBitMsg::ReadFloat( void ) const { float value; *reinterpret_cast(&value) = ReadBits( 32 ); diff --git a/neo/tools/debugger/DebuggerClient.cpp b/neo/tools/debugger/DebuggerClient.cpp index 982029f3..3d50d523 100644 --- a/neo/tools/debugger/DebuggerClient.cpp +++ b/neo/tools/debugger/DebuggerClient.cpp @@ -226,8 +226,13 @@ void rvDebuggerClient::HandleBreak ( idBitMsg* msg ) msg->ReadString ( filename, MAX_PATH ); mBreakFilename = filename; +#if D3_SIZEOFPTR == 4 // 32 bit int ptr32b = msg->ReadInt(); mBreakProgram = (idProgram*)ptr32b; +#else + int64_t ptr64b = msg->ReadInt64(); + mBreakProgram = (idProgram*)ptr64b; +#endif // Clear the variables mVariables.Clear ( ); diff --git a/neo/tools/debugger/DebuggerFindDlg.cpp b/neo/tools/debugger/DebuggerFindDlg.cpp index 59ce96c6..cf5dd28f 100644 --- a/neo/tools/debugger/DebuggerFindDlg.cpp +++ b/neo/tools/debugger/DebuggerFindDlg.cpp @@ -53,7 +53,7 @@ Launch the dialog */ bool rvDebuggerFindDlg::DoModal ( rvDebuggerWindow* parent ) { - if ( DialogBoxParam ( parent->GetInstance(), MAKEINTRESOURCE(IDD_DBG_FIND), parent->GetWindow(), DlgProc, (LONG)this ) ) + if ( DialogBoxParam ( parent->GetInstance(), MAKEINTRESOURCE(IDD_DBG_FIND), parent->GetWindow(), DlgProc, (LPARAM)this ) ) { return true; } @@ -70,7 +70,7 @@ Dialog Procedure for the find dialog */ INT_PTR CALLBACK rvDebuggerFindDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - rvDebuggerFindDlg* dlg = (rvDebuggerFindDlg*) GetWindowLong ( wnd, GWL_USERDATA ); + rvDebuggerFindDlg* dlg = (rvDebuggerFindDlg*) GetWindowLongPtr ( wnd, GWLP_USERDATA); switch ( msg ) { @@ -80,7 +80,8 @@ INT_PTR CALLBACK rvDebuggerFindDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, case WM_INITDIALOG: dlg = (rvDebuggerFindDlg*) lparam; - SetWindowLong ( wnd, GWL_USERDATA, (LONG) dlg ); + + SetWindowLongPtr ( wnd, GWLP_USERDATA, (LONG_PTR) dlg ); dlg->mWnd = wnd; SetWindowText ( GetDlgItem ( dlg->mWnd, IDC_DBG_FIND ), dlg->mFindText ); return TRUE; diff --git a/neo/tools/debugger/DebuggerQuickWatchDlg.cpp b/neo/tools/debugger/DebuggerQuickWatchDlg.cpp index 7cf18fe3..cee73a8f 100644 --- a/neo/tools/debugger/DebuggerQuickWatchDlg.cpp +++ b/neo/tools/debugger/DebuggerQuickWatchDlg.cpp @@ -55,7 +55,7 @@ bool rvDebuggerQuickWatchDlg::DoModal ( rvDebuggerWindow* window, int callstackD mDebuggerWindow = window; mVariable = variable?variable:""; - DialogBoxParam ( window->GetInstance(), MAKEINTRESOURCE(IDD_DBG_QUICKWATCH), window->GetWindow(), DlgProc, (LONG)this ); + DialogBoxParam ( window->GetInstance(), MAKEINTRESOURCE(IDD_DBG_QUICKWATCH), window->GetWindow(), DlgProc, (LPARAM)this ); return true; } @@ -69,7 +69,7 @@ Dialog Procedure for the quick watch dialog */ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - rvDebuggerQuickWatchDlg* dlg = (rvDebuggerQuickWatchDlg*) GetWindowLong ( wnd, GWL_USERDATA ); + rvDebuggerQuickWatchDlg* dlg = (rvDebuggerQuickWatchDlg*) GetWindowLongPtr ( wnd, GWLP_USERDATA); switch ( msg ) { @@ -128,7 +128,7 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w // Attach the dialog class pointer to the window dlg = (rvDebuggerQuickWatchDlg*) lparam; - SetWindowLong ( wnd, GWL_USERDATA, lparam ); + SetWindowLongPtr ( wnd, GWLP_USERDATA, lparam ); dlg->mWnd = wnd; GetClientRect ( wnd, &client ); diff --git a/neo/tools/debugger/DebuggerServer.cpp b/neo/tools/debugger/DebuggerServer.cpp index b2711f59..1bf191d6 100644 --- a/neo/tools/debugger/DebuggerServer.cpp +++ b/neo/tools/debugger/DebuggerServer.cpp @@ -611,7 +611,13 @@ void rvDebuggerServer::Break ( idInterpreter* interpreter, idProgram* program, i msg.WriteShort ( (short)DBMSG_BREAK ); msg.WriteInt ( linenumber ); msg.WriteString ( fileStr.c_str() ); + +#if D3_SIZEOFPTR == 4 // 32 bit msg.WriteInt( (int)mBreakProgram ); +#else + msg.WriteInt64( (int64_t)mBreakProgram ); +#endif + SendPacket ( msg.GetData(), msg.GetSize() ); // Suspend the game thread. Since this will be called from within the main game thread diff --git a/neo/tools/debugger/DebuggerWindow.cpp b/neo/tools/debugger/DebuggerWindow.cpp index ca0b95c3..84f6cd0f 100644 --- a/neo/tools/debugger/DebuggerWindow.cpp +++ b/neo/tools/debugger/DebuggerWindow.cpp @@ -249,7 +249,7 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp { static int lastStart = -1; static int lastEnd = -1; - rvDebuggerWindow* window = (rvDebuggerWindow*)GetWindowLong ( wnd, GWL_USERDATA ); + rvDebuggerWindow* window = (rvDebuggerWindow*)GetWindowLongPtr ( wnd, GWLP_USERDATA ); WNDPROC wndproc = window->mOldScriptProc; switch ( msg ) @@ -369,7 +369,7 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLong ( wnd, GWL_USERDATA ); + rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLongPtr ( wnd, GWLP_USERDATA ); switch ( msg ) { @@ -841,9 +841,9 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) mWndScript = CreateWindow ( "RichEdit20A", "", WS_CHILD|WS_BORDER|ES_NOHIDESEL|ES_READONLY|ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL|ES_AUTOHSCROLL|WS_VSCROLL|WS_HSCROLL, 0, 0, 100, 100, mWnd, (HMENU) IDC_DBG_SCRIPT, mInstance, 0 ); SendMessage ( mWndScript, EM_SETEVENTMASK, 0, ENM_SCROLL | ENM_CHANGE | ENM_UPDATE | ENM_SCROLLEVENTS | ENM_REQUESTRESIZE) ; SendMessage ( mWndScript, EM_SETWORDBREAKPROC, 0, (LPARAM) ScriptWordBreakProc ); - mOldScriptProc = (WNDPROC)GetWindowLong ( mWndScript, GWL_WNDPROC ); - SetWindowLong ( mWndScript, GWL_USERDATA, (LONG)this ); - SetWindowLong ( mWndScript, GWL_WNDPROC, (LONG)ScriptWndProc ); + mOldScriptProc = (WNDPROC)GetWindowLongPtr ( mWndScript, GWLP_WNDPROC ); + SetWindowLongPtr ( mWndScript, GWLP_USERDATA, (LONG_PTR)this ); + SetWindowLongPtr ( mWndScript, GWLP_WNDPROC, (LONG_PTR)ScriptWndProc ); SendMessage ( mWndScript, EM_SETTABSTOPS, 1, (LPARAM)&tabsize ); @@ -869,8 +869,8 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) SendMessage ( mWndConsole, EM_SETBKGNDCOLOR, 0, GetSysColor ( COLOR_3DFACE ) ); mWndMargin = CreateWindow ( "STATIC", "", WS_VISIBLE|WS_CHILD, 0, 0, 0, 0, mWndScript, (HMENU)IDC_DBG_SPLITTER, mInstance, NULL ); - SetWindowLong ( mWndMargin, GWL_USERDATA, (LONG)this ); - SetWindowLong ( mWndMargin, GWL_WNDPROC, (LONG)MarginWndProc ); + SetWindowLongPtr ( mWndMargin, GWLP_USERDATA, (LONG_PTR)this ); + SetWindowLongPtr ( mWndMargin, GWLP_WNDPROC, (LONG_PTR)MarginWndProc ); mWndBorder = CreateWindow ( "STATIC", "", WS_VISIBLE|WS_CHILD|SS_GRAYFRAME, 0, 0, 0, 0, mWnd, (HMENU)IDC_DBG_BORDER, mInstance, NULL ); @@ -1150,7 +1150,7 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) LONG num; LONG dem; - SendMessage ( mWndScript, EM_GETZOOM, (LONG)&num, (LONG)&dem ); + SendMessage ( mWndScript, EM_GETZOOM, (WPARAM)&num, (LPARAM)&dem ); if ( num != mZoomScaleNum || dem != mZoomScaleDem ) { mZoomScaleNum = num; @@ -1254,7 +1254,7 @@ Window procedure for the deubgger window */ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLong ( wnd, GWL_USERDATA ); + rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLongPtr ( wnd, GWLP_USERDATA ); switch ( msg ) { @@ -1277,7 +1277,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, gDebuggerApp.GetOptions().SetString ( va("watch%d", i ), "" ); window->mWnd = NULL; - SetWindowLong ( wnd, GWL_USERDATA, 0 ); + SetWindowLongPtr ( wnd, GWLP_USERDATA, 0 ); break; } @@ -1443,7 +1443,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, { CREATESTRUCT* cs = (CREATESTRUCT*) lparam; window = (rvDebuggerWindow*) cs->lpCreateParams; - SetWindowLong ( wnd, GWL_USERDATA, (LONG)cs->lpCreateParams ); + SetWindowLongPtr ( wnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams ); window->mWnd = wnd; window->HandleCreate ( wparam, lparam );