MCPcopy Create free account
hub / github.com/TASEmulators/fceux / UpdateMemoryView

Function UpdateMemoryView

src/drivers/win/memview.cpp:469–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467 return;
468}
469void UpdateMemoryView(int draw_all)
470{
471 if (!hMemView) return;
472 const int MemFontWidth = debugSystem->HexeditorFontWidth + HexCharSpacing;
473 const int MemFontHeight = debugSystem->HexeditorFontHeight + HexRowHeightBorder;
474 const char hex[] = "0123456789ABCDEF";
475 const COLORREF CBackColor = MKRGB(HexBack);
476 const COLORREF CForeColor = MKRGB(HexFore);
477 int i, j;
478 int byteValue;
479 int byteHighlightingValue;
480 char str[100];
481
482 if (PreviousCurOffset != CurOffset)
483 resetHighlightingActivityLog();
484
485 for (i = CurOffset; i < CurOffset + DataAmount; i += 16)
486 {
487 const int MemLineRow = MemFontHeight * ((i - CurOffset) / 16);
488 int MemLinePos = 8 * MemFontWidth;
489 int pos = i - CurOffset;
490 if ((PreviousCurOffset != CurOffset) || draw_all)
491 {
492 SetBkColor(HDataDC, CBackColor); //addresses back color
493 if (i < MaxSize)
494 SetTextColor(HDataDC, MKRGB(HexAddr)); //addresses text color #000000 = black, #FFFFFF = white
495 else
496 SetTextColor(HDataDC, MKRGB(HexBound)); //addresses out of bounds
497 sprintf(str, "%06X: :", i);
498 ExtTextOut(HDataDC, 0, MemLineRow, NULL, NULL, str, strlen(str), NULL);
499 }
500 for (j = 0; j < 16; j++)
501 {
502 byteValue = GetMemViewData(i + j);
503 if (MemView_HighlightActivity && ((PreviousValues[pos] != byteValue) && (PreviousValues[pos] != PREVIOUS_VALUE_UNDEFINED)))
504 byteHighlightingValue = HighlightedBytes[pos] = MemView_HighlightActivity_FadingPeriod;
505 else
506 byteHighlightingValue = HighlightedBytes[pos];
507
508 if ((CursorEndAddy == -1) && (CursorStartAddy == i + j))
509 {
510 //print up single highlighted text
511 if (TempData != PREVIOUS_VALUE_UNDEFINED)
512 {
513 // User is typing New Data
514 // 1st nibble
515 SetBkColor(HDataDC, RGB(255, 255, 255));
516 SetTextColor(HDataDC, RGB(255, 0, 0));
517 str[0] = hex[(byteValue >> 4) & 0xF];
518 str[1] = 0;
519 ExtTextOut(HDataDC, MemLinePos, MemLineRow, NULL, NULL, str, 1, NULL);
520 // 2nd nibble
521 SetBkColor(HDataDC, CForeColor);
522 SetTextColor(HDataDC, CBackColor);
523 str[0] = hex[(byteValue >> 0) & 0xF];
524 str[1] = 0;
525 ExtTextOut(HDataDC, MemLinePos + MemFontWidth, MemLineRow, NULL, NULL, str, 1, NULL);
526 }

Callers 3

UpdateColorTableFunction · 0.85
MemViewCallBFunction · 0.85
_updateWindowFunction · 0.85

Calls 3

GetMemViewDataFunction · 0.85
FCEUI_EmulationPausedFunction · 0.85

Tested by

no test coverage detected