From 7500446b2c7ea2fbeb0e19ad960565264c38487a Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Fri, 29 May 2020 16:53:20 -0400 Subject: [PATCH] Changed memory buffer setup to allow for color and activity data to be stored for each address. --- src/drivers/sdl/memview.cpp | 48 ++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/src/drivers/sdl/memview.cpp b/src/drivers/sdl/memview.cpp index 8d025876..0912dfc8 100644 --- a/src/drivers/sdl/memview.cpp +++ b/src/drivers/sdl/memview.cpp @@ -45,6 +45,13 @@ static unsigned int highlightActivityColors[HIGHLIGHT_ACTIVITY_NUM_COLORS] = 0xba00ab, 0x6f00b0, 0x3700c2, 0x000cba, 0x002cc9, 0x0053bf, 0x0072cf, 0x3c8bc7 }; + +struct memByte_t +{ + unsigned char data; + unsigned char color; + unsigned char actv; +}; //******************************************************************************************************* // Memory View (Hex Editor) Window //******************************************************************************************************* @@ -131,13 +138,14 @@ struct memViewWin_t int evntSrcID; int numLines; int numCharsPerLine; - unsigned char *mbuf; - unsigned char *colorbuf; + struct memByte_t *mbuf; int mbuf_size; GtkCellRenderer *hexByte_renderer[16]; bool redraw; int (*memAccessFunc)( unsigned int offset); + std::vector colorList; + enum { MODE_NES_RAM = 0, MODE_NES_PPU, @@ -160,7 +168,6 @@ struct memViewWin_t dialog_op = 0; mode = MODE_NES_RAM; mbuf = NULL; - colorbuf = NULL; mbuf_size = 0; numLines = 0; evntSrcID = 0; @@ -188,10 +195,6 @@ struct memViewWin_t { free(mbuf); mbuf = NULL; } - if ( colorbuf != NULL ) - { - free(colorbuf); colorbuf = NULL; - } } void setMode(int new_mode) @@ -295,11 +298,13 @@ static int conv2xchar( int i ) return c; } -static void initMem( unsigned char *c, int size ) +static void initMem( struct memByte_t *c, int size ) { for (int i=0; i 0 ) + if ( mbuf[addr].color > 0 ) { - colorbuf[addr]--; + mbuf[addr].color--; valChg[i] = 1; } } @@ -525,7 +519,7 @@ void memViewWin_t::showMemViewResults (int reset) gtk_text_buffer_delete( textbuf, &iter, &next_iter ); } //gtk_text_buffer_insert( textbuf, &iter, valStr[i], -1 ); - gtk_text_buffer_insert_with_tags( textbuf, &iter, valStr[i], -1, highlight[ colorbuf[addr] ], NULL ); + gtk_text_buffer_insert_with_tags( textbuf, &iter, valStr[i], -1, highlight[ mbuf[addr].color ], NULL ); } else {