@@ -60,9 +60,9 @@ void Disassembly::updateColors()
60
60
mInstructionHighlightColor = ConfigColor (" InstructionHighlightColor" );
61
61
mSelectionColor = ConfigColor (" DisassemblySelectionColor" );
62
62
mCipBackgroundColor = ConfigColor (" DisassemblyCipBackgroundColor" );
63
+ mCipColor = ConfigColor (" DisassemblyCipColor" );
63
64
mBreakpointBackgroundColor = ConfigColor (" DisassemblyBreakpointBackgroundColor" );
64
65
mBreakpointColor = ConfigColor (" DisassemblyBreakpointColor" );
65
- mCipColor = ConfigColor (" DisassemblyCipColor" );
66
66
mHardwareBreakpointBackgroundColor = ConfigColor (" DisassemblyHardwareBreakpointBackgroundColor" );
67
67
mHardwareBreakpointColor = ConfigColor (" DisassemblyHardwareBreakpointColor" );
68
68
mBookmarkBackgroundColor = ConfigColor (" DisassemblyBookmarkBackgroundColor" );
@@ -73,6 +73,12 @@ void Disassembly::updateColors()
73
73
mSelectedAddressColor = ConfigColor (" DisassemblySelectedAddressColor" );
74
74
mAddressBackgroundColor = ConfigColor (" DisassemblyAddressBackgroundColor" );
75
75
mAddressColor = ConfigColor (" DisassemblyAddressColor" );
76
+ mBytesColor = ConfigColor (" DisassemblyBytesColor" );
77
+ mModifiedBytesColor = ConfigColor (" DisassemblyModifiedBytesColor" );
78
+ mAutoCommentColor = ConfigColor (" DisassemblyAutoCommentColor" );
79
+ mAutoCommentBackgroundColor = ConfigColor (" DisassemblyAutoCommentBackgroundColor" );
80
+ mCommentColor = ConfigColor (" DisassemblyCommentColor" );
81
+ mCommentBackgroundColor = ConfigColor (" DisassemblyCommentBackgroundColor" );
76
82
77
83
CapstoneTokenizer::UpdateColors ();
78
84
mDisasm ->UpdateConfig ();
@@ -220,26 +226,26 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
220
226
{
221
227
if (bpxtype & bp_normal) // normal breakpoint
222
228
{
223
- painter->setPen (QPen (ConfigColor ( " DisassemblyBreakpointColor " ) ));
224
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBreakpointBackgroundColor " ) )); // fill red
229
+ painter->setPen (QPen (mBreakpointColor ));
230
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBreakpointBackgroundColor )); // fill red
225
231
}
226
232
else if (bpxtype & bp_hardware) // hardware breakpoint only
227
233
{
228
- painter->setPen (QPen (ConfigColor ( " DisassemblyHardwareBreakpointColor " ) ));
229
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyHardwareBreakpointBackgroundColor " ) )); // fill red
234
+ painter->setPen (QPen (mHardwareBreakpointColor ));
235
+ painter->fillRect (QRect (x, y, w, h), QBrush (mHardwareBreakpointBackgroundColor )); // fill red
230
236
}
231
237
else // other cases (memory breakpoint in disassembly) -> do as normal
232
238
{
233
239
QColor background;
234
240
if (wIsSelected)
235
241
{
236
- background = ConfigColor ( " DisassemblySelectedAddressBackgroundColor " ) ;
237
- painter->setPen (QPen (ConfigColor ( " DisassemblySelectedAddressColor " ) )); // black address (DisassemblySelectedAddressColor)
242
+ background = mSelectedAddressBackgroundColor ;
243
+ painter->setPen (QPen (mSelectedAddressColor )); // black address (DisassemblySelectedAddressColor)
238
244
}
239
245
else
240
246
{
241
- background = ConfigColor ( " DisassemblyAddressBackgroundColor " ) ;
242
- painter->setPen (QPen (ConfigColor ( " DisassemblyAddressColor " ) ));
247
+ background = mAddressBackgroundColor ;
248
+ painter->setPen (QPen (mAddressColor ));
243
249
}
244
250
if (background.alpha ())
245
251
painter->fillRect (QRect (x, y, w, h), QBrush (background)); // fill background
@@ -253,50 +259,50 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
253
259
{
254
260
if (bpxtype == bp_none) // label + bookmark
255
261
{
256
- painter->setPen (QPen (ConfigColor ( " DisassemblyLabelColor " ) )); // red -> address + label text
257
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBookmarkBackgroundColor " ) )); // fill label background
262
+ painter->setPen (QPen (mLabelColor )); // red -> address + label text
263
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBookmarkBackgroundColor )); // fill label background
258
264
}
259
265
else // label+breakpoint+bookmark
260
266
{
261
- QColor color = ConfigColor ( " DisassemblyBookmarkBackgroundColor " ) ;
267
+ QColor color = mBookmarkBackgroundColor ;
262
268
if (!color.alpha ()) // we don't want transparent text
263
- color = ConfigColor ( " DisassemblyAddressColor " ) ;
269
+ color = mAddressColor ;
264
270
painter->setPen (QPen (color));
265
271
if (bpxtype & bp_normal) // label + bookmark + normal breakpoint
266
272
{
267
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBreakpointBackgroundColor " ) )); // fill red
273
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBreakpointBackgroundColor )); // fill red
268
274
}
269
275
else if (bpxtype & bp_hardware) // label + bookmark + hardware breakpoint only
270
276
{
271
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyHardwareBreakpointBackgroundColor " ) )); // fill ?
277
+ painter->fillRect (QRect (x, y, w, h), QBrush (mHardwareBreakpointBackgroundColor )); // fill ?
272
278
}
273
279
}
274
280
}
275
281
else // bookmark, no label
276
282
{
277
283
if (bpxtype == bp_none) // bookmark only
278
284
{
279
- painter->setPen (QPen (ConfigColor ( " DisassemblyBookmarkColor " ) )); // black address
280
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBookmarkBackgroundColor " ) )); // fill bookmark color
285
+ painter->setPen (QPen (mBookmarkColor )); // black address
286
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBookmarkBackgroundColor )); // fill bookmark color
281
287
}
282
288
else // bookmark + breakpoint
283
289
{
284
- QColor color = ConfigColor ( " DisassemblyBookmarkBackgroundColor " ) ;
290
+ QColor color = mBookmarkBackgroundColor ;
285
291
if (!color.alpha ()) // we don't want transparent text
286
- color = ConfigColor ( " DisassemblyAddressColor " ) ;
292
+ color = mAddressColor ;
287
293
painter->setPen (QPen (color));
288
294
if (bpxtype & bp_normal) // bookmark + normal breakpoint
289
295
{
290
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBreakpointBackgroundColor " ) )); // fill red
296
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBreakpointBackgroundColor )); // fill red
291
297
}
292
298
else if (bpxtype & bp_hardware) // bookmark + hardware breakpoint only
293
299
{
294
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyHardwareBreakpointBackgroundColor " ) )); // fill red
300
+ painter->fillRect (QRect (x, y, w, h), QBrush (mHardwareBreakpointBackgroundColor )); // fill red
295
301
}
296
302
else // other cases (bookmark + memory breakpoint in disassembly) -> do as normal
297
303
{
298
- painter->setPen (QPen (ConfigColor ( " DisassemblyBookmarkColor " ))) ; // black address (DisassemblySelectedAddressColor)
299
- painter->fillRect (QRect (x, y, w, h), QBrush (ConfigColor ( " DisassemblyBookmarkBackgroundColor " ) )); // fill bookmark color
304
+ painter->setPen (QPen (mBookmarkColor )) ; // black address
305
+ painter->fillRect (QRect (x, y, w, h), QBrush (mBookmarkBackgroundColor )); // fill bookmark color
300
306
}
301
307
}
302
308
}
@@ -339,8 +345,6 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
339
345
int jumpsize = paintJumpsGraphic (painter, x + funcsize, y - 1 , wRVA); // jump line
340
346
341
347
// draw bytes
342
- QColor bytesColor = ConfigColor (" DisassemblyBytesColor" );
343
- QColor patchedBytesColor = ConfigColor (" DisassemblyModifiedBytesColor" );
344
348
QList<RichTextPainter::CustomRichText_t> richBytes;
345
349
RichTextPainter::CustomRichText_t space;
346
350
space.highlight = false ;
@@ -354,7 +358,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
354
358
if (i)
355
359
richBytes.push_back (space);
356
360
curByte.text = QString (" %1" ).arg ((unsigned char )(mInstBuffer .at (rowOffset).dump .at (i)), 2 , 16 , QChar (' 0' )).toUpper ();
357
- curByte.textColor = DbgFunctions ()->PatchGet (cur_addr + i) ? patchedBytesColor : bytesColor ;
361
+ curByte.textColor = DbgFunctions ()->PatchGet (cur_addr + i) ? mModifiedBytesColor : mBytesColor ;
358
362
richBytes.push_back (curByte);
359
363
}
360
364
RichTextPainter::paintRichText (painter, x, y, getColumnWidth (col), getRowHeight (), jumpsize + funcsize, &richBytes, getCharWidth ());
@@ -417,14 +421,14 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
417
421
QColor backgroundColor;
418
422
if (comment[0 ] == ' \1 ' ) // automatic comment
419
423
{
420
- penColor = ConfigColor ( " DisassemblyAutoCommentColor " ) ;
421
- backgroundColor = ConfigColor ( " DisassemblyAutoCommentBackgroundColor " ) ;
424
+ penColor = mAutoCommentColor ;
425
+ backgroundColor = mAutoCommentBackgroundColor ;
422
426
commentText = QString (comment + 1 );
423
427
}
424
428
else // user comment
425
429
{
426
- penColor = ConfigColor ( " DisassemblyCommentColor " ) ;
427
- backgroundColor = ConfigColor ( " DisassemblyCommentBackgroundColor " ) ;
430
+ penColor = mCommentColor ;
431
+ backgroundColor = mCommentBackgroundColor ;
428
432
commentText = comment;
429
433
}
430
434
painter->setPen (penColor);
@@ -674,28 +678,27 @@ void Disassembly::keyPressEvent(QKeyEvent* event)
674
678
*/
675
679
dsint Disassembly::sliderMovedHook (int type, dsint value, dsint delta)
676
680
{
677
- dsint wNewValue;
678
681
679
- if (type == QAbstractSlider::SliderNoAction) // QAbstractSlider::SliderNoAction is used to disassembe at a specific address
680
- {
681
- wNewValue = value + delta;
682
- }
683
- else if (type == QAbstractSlider::SliderMove) // If it's a slider action, disassemble one instruction back and one instruction next in order to be aligned on a real instruction
682
+ // QAbstractSlider::SliderNoAction is used to disassembe at a specific address
683
+ if (type == QAbstractSlider::SliderNoAction)
684
+ return value + delta;
685
+
686
+ // If it's a slider action, disassemble one instruction back and one instruction next in order to be aligned on a real instruction
687
+ if (type == QAbstractSlider::SliderMove)
684
688
{
689
+ dsint wNewValue = 0 ;
690
+
685
691
if (value + delta > 0 )
686
692
{
687
693
wNewValue = getInstructionRVA (value + delta, -1 );
688
694
wNewValue = getInstructionRVA (wNewValue, 1 );
689
695
}
690
- else
691
- wNewValue = 0 ;
692
- }
693
- else // For other actions, disassemble according to the delta
694
- {
695
- wNewValue = getInstructionRVA (value, delta);
696
+
697
+ return wNewValue;
696
698
}
697
699
698
- return wNewValue;
700
+ // For other actions, disassemble according to the delta
701
+ return getInstructionRVA (value, delta);
699
702
}
700
703
701
704
0 commit comments