Guest User

Untitled

a guest
Apr 30th, 2017
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.89 KB | None | 0 0
  1.     bool CWispHexWnd::OnUpdateClient(WISP_MSG *pMsg)
  2.     {
  3.         unsigned short Buffer[0x200];
  4.  
  5.         CWispWnd::OnUpdateClient(pMsg);
  6.  
  7.         int OffsetMode = GetOffsetMode();
  8.         m_Size1 = 0;
  9.  
  10.  
  11.         if (m_bShowOffset != 0)
  12.         {
  13.             unsigned int v6 = m_nByte_Line/m_ShowLength;
  14.  
  15.             m_ClientDC.m_TextStyle = 0;
  16.             int XStart = m_ItemSpace[0] + m_ItemSpace[1];
  17.             int GroupLen = 3 * m_ShowLength;
  18.  
  19.             m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  20.             m_ClientDC.m_TextColor = m_ItemColor[1];
  21.  
  22.             if (v6 > 0)
  23.             {
  24.                 unsigned int HexLen = 0;
  25.                 int AR_v55 = 1;
  26.                 int CC____v52 = v6;
  27.                 do {
  28.                 //  int n = 0;
  29.                     if (m_ShowOffset)
  30.                     {
  31.                         unsigned short *v56 = Buffer;
  32.                         for (int n = 0; n < m_ShowLength; ++n)
  33.                         {
  34.                             TSPrintf(v56, WSTR("+%X"), AR_v55*m_ShowLength-n-1);
  35.                             v56 += 2;
  36.                         }
  37.                     } else
  38.                     {
  39.                         unsigned short *v56 = Buffer;
  40.                         for (int n = 0; n < m_ShowLength; ++n)
  41.                         {
  42.                             TSPrintf(v56, WSTR("%X "), (AR_v55*m_ShowLength-n-1+m_CurAddr) % m_nByte_Line);
  43.                             v56 += 2;
  44.                         }
  45.                     }
  46.                                         m_ClientDC.DrawString(m_CharWidth * (XStart + HexLen - m_CharXPos),
  47.                         0, Buffer, 2 * m_ShowLength, 0, 0);
  48.  
  49.                     AR_v55++;
  50.                     HexLen += GroupLen;
  51.                     --CC____v52;
  52.                 } while (CC____v52 );
  53.             }
  54.         }
  55.  
  56.         if (m_bFloatModeOff)
  57.         {
  58.             unsigned long Addr = GetAddress(m_StringAddr);
  59.             if (Addr != m_CurAddr)
  60.                 ViewAddressMsg(Addr, 0);
  61.         }
  62.  
  63.  
  64.         memset(m_LenArray, 0, sizeof(m_LenArray));
  65.  
  66.         unsigned char DataBuffer[32];
  67.         memset(DataBuffer, 0, sizeof(DataBuffer));
  68.  
  69.         unsigned short szSpace[32];
  70.  
  71.         for (int nLine = 0; nLine < m_nLines_Page; ++nLine)
  72.         {
  73.             int XStart = m_ItemSpace[0];
  74.             int YLine = (OffsetMode + nLine) * m_LineHeight;
  75.  
  76.             unsigned long Address = m_CurAddr + nLine * m_nByte_Line;
  77.             if (m_AddressMode == 0)
  78.             {
  79.                 TSPrintf(Buffer, WSTR("%08X:"), Address);
  80.             } else
  81.             {
  82.                 long AddressOffset = Address - m_AddressModeOffs;
  83.                 if (AddressOffset > 0)
  84.                     TSPrintf(Buffer, WSTR("$+%X"), AddressOffset);
  85.                 else
  86.                 if (AddressOffset < 0)
  87.                     TSPrintf(Buffer, WSTR("$-%X"), -AddressOffset);
  88.                 else
  89.                     TStrCpy(Buffer, "$ ==>");
  90.             }
  91.  
  92.             int Len = TStrLen(Buffer);
  93.  
  94.             m_LenArray[nLine][0] = Len;
  95.  
  96.             m_ClientDC.m_TextStyle = 0;
  97.             m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  98.             m_ClientDC.m_TextColor = m_ItemColor[1];
  99.  
  100.             m_ClientDC.DrawString( (XStart - m_CharXPos) * m_CharWidth,
  101.                             YLine, Buffer, Len, 0, 0);
  102.  
  103.             XStart += m_ItemSpace[1];
  104.  
  105.             unsigned long AsciiLen = m_ImageBase + m_ImageSize - (nLine * m_nByte_Line) - m_CurAddr;   
  106.             if (AsciiLen > m_nByte_Line)
  107.                 AsciiLen = m_nByte_Line;
  108.  
  109.             TStrCpy(szSpace, CWispHexWnd::m_Spaces);
  110.             szSpace[m_ShowLength] = 0;
  111.  
  112.             int HexLen = AsciiLen / m_ShowLength;
  113.             if (AsciiLen % m_ShowLength)
  114.                 ++HexLen;
  115.  
  116.             int GroupLen = 3 * m_ShowLength;
  117.  
  118.             m_LenArray[nLine][1] = HexLen * GroupLen;
  119.  
  120.             int GroupX = 0;
  121.            
  122.             for (int HexIt = 0; HexIt < HexLen; ++HexIt)
  123.             {
  124.                 int bSame = 0;
  125.                 if (!ReadMemory(Address + HexIt * m_ShowLength, DataBuffer, m_ShowLength))
  126.                 {
  127.                     TStrCpy(Buffer, CWispHexWnd::m_UnReadable);
  128.                 } else
  129.                 {
  130.                     THexBytesToStr(DataBuffer, Buffer, AsciiLen, m_ShowLength, szSpace);
  131.                    
  132.                     for (int i = 0; i < m_ShowLength; ++i)
  133.                         m_Array1[i+ m_Size1] = DataBuffer[i];
  134.  
  135.                     m_Size1 += m_ShowLength;
  136.                     bSame = Same(Address + HexIt * m_ShowLength, DataBuffer);
  137.                 }
  138.  
  139.                 int HexAttr = GetHexByteAttribute(m_CurAddr + nLine * m_nByte_Line + HexIt * m_ShowLength);
  140.  
  141.                 if (HexAttr == 0)
  142.                 {
  143.                     m_ClientDC.m_TextStyle = 0;
  144.  
  145.                     if (!bSame)
  146.                     {
  147.                         m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  148.                         m_ClientDC.m_TextColor = m_ItemColor[2];
  149.                     } else
  150.                     {
  151.                         m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  152.                         m_ClientDC.m_TextColor = 0xFFFF00;
  153.                     }
  154.                 } else
  155.                 if (HexAttr == 1)
  156.                 {
  157.                     m_ClientDC.m_TextStyle = 1;
  158.  
  159.                     m_ClientDC.m_OldTextBKColor = m_ClientDC.m_TextBKColor;
  160.                     m_ClientDC.m_TextBKColor = m_BSelColor;
  161.                     if (!bSame)
  162.                     {
  163.                         m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  164.                         m_ClientDC.m_TextColor = m_TSelColor;
  165.                     } else
  166.                     {
  167.                         m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  168.                         m_ClientDC.m_TextColor = 0xFFFF00;
  169.                     }
  170.                 } else
  171.                 if (HexAttr == 2)
  172.                 {
  173.                     m_ClientDC.m_TextStyle = 1;
  174.                     m_ClientDC.m_OldTextBKColor = m_ClientDC.m_TextBKColor;
  175.                     m_ClientDC.m_TextBKColor = m_BBPXColor;
  176.                     m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  177.                     m_ClientDC.m_TextColor = m_ItemColor[2];
  178.                 }
  179.  
  180.                 m_ClientDC.DrawString(m_CharWidth * (XStart + GroupX - m_CharXPos),
  181.                         YLine, Buffer, 2 * m_ShowLength, 0, 0);
  182.                 GroupX += GroupLen;
  183.             }
  184.  
  185.             XStart += m_ItemSpace[2];
  186.  
  187.             m_LenArray[nLine][2] = m_nByte_Line;
  188.  
  189.             for (int AsciiIt = 0; AsciiIt < AsciiLen; ++AsciiIt)
  190.             {
  191.                 if (!ReadMemory(Address + AsciiIt, DataBuffer, 1))
  192.                     TStrCpy(Buffer, CWispHexWnd::m_UnReadableASCII);
  193.                 else    THexBytesToASCII(DataBuffer, Buffer, 1);
  194.  
  195.                 int HexAttr = GetHexByteAttribute(AsciiIt + m_CurAddr + nLine * m_nByte_Line);
  196.  
  197.                 if (HexAttr == 0)
  198.                 {
  199.                     m_ClientDC.m_TextStyle = 0;
  200.  
  201.                     m_ClientDC.m_OldTextBKColor = m_ClientDC.m_TextBKColor;
  202.                     m_ClientDC.m_TextBKColor = m_pWispBase->m_pWispDrawObj->m_crSystem[20];
  203.                     m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  204.                     m_ClientDC.m_TextColor = m_ItemColor[3];
  205.                 } else
  206.                 if (HexAttr == 1)
  207.                 {
  208.                     m_ClientDC.m_TextStyle = 1;
  209.  
  210.                     m_ClientDC.m_OldTextBKColor = m_ClientDC.m_TextBKColor;
  211.                     m_ClientDC.m_TextBKColor = m_BSelColor;
  212.                     m_ClientDC.m_OldTextColor = m_ClientDC.m_TextColor;
  213.                     m_ClientDC.m_TextColor = m_TSelColor;
  214.                 }
  215.  
  216.                 m_ClientDC.DrawString(m_CharWidth * (XStart + AsciiIt - m_CharXPos),
  217.                             YLine, Buffer, 1, 0, 0);
  218.             }
  219.         }
  220.  
  221.        
  222.         m_Offset1 = m_CurAddr;
  223.  
  224.         if (!m_Size2)
  225.             SyncBuffer();
  226.  
  227.         return false;
  228.     }
Add Comment
Please, Sign In to add comment