From 6efadcc4d43b3e3dbd6001fc1b78c9d55850dfd1 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:52:53 -0400 Subject: [PATCH 1/2] GP-4206 - Theming - Minor fixes --- Ghidra/Features/Base/certification.manifest | 4 ++ .../Base/data/base.icons.theme.properties | 8 ++++ .../core/osgi/BundleStatusTableModel.java | 38 ++++++++++-------- .../main/resources/images/FunctionScope.gif | Bin 98 -> 112 bytes .../main/resources/images/Namespace.dark.gif | Bin 0 -> 94 bytes .../src/main/resources/images/Namespace.gif | Bin 79 -> 94 bytes .../resources/images/ThunkFunction.dark.gif | Bin 0 -> 124 bytes .../main/resources/images/ThunkFunction.gif | Bin 118 -> 124 bytes .../images/closedFolderNamespaces.dark.png | Bin 0 -> 608 bytes .../images/openFolderNamespaces.dark.png | Bin 0 -> 803 bytes .../app/plugin/gui/ThemeChooserDialog.java | 1 + 11 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 Ghidra/Features/Base/src/main/resources/images/Namespace.dark.gif create mode 100644 Ghidra/Features/Base/src/main/resources/images/ThunkFunction.dark.gif create mode 100644 Ghidra/Features/Base/src/main/resources/images/closedFolderNamespaces.dark.png create mode 100644 Ghidra/Features/Base/src/main/resources/images/openFolderNamespaces.dark.png diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest index 64a1f11ba3..e9f6a212ad 100644 --- a/Ghidra/Features/Base/certification.manifest +++ b/Ghidra/Features/Base/certification.manifest @@ -707,12 +707,14 @@ src/main/resources/images/LocalVariable.gif||GHIDRA||||END| src/main/resources/images/MarkSelection.png||GHIDRA||||END| src/main/resources/images/Merge.png||GHIDRA||||END| src/main/resources/images/MultiDuplicateData.png||GHIDRA||||END| +src/main/resources/images/Namespace.dark.gif||GHIDRA||||END| src/main/resources/images/Namespace.gif||GHIDRA||||END| src/main/resources/images/NextHighlightBlock16.gif||GHIDRA||||END| src/main/resources/images/NextSelectionBlock16.gif||GHIDRA||||END| src/main/resources/images/Parameter.gif||GHIDRA||||END| src/main/resources/images/PreviousHighlightBlock16.gif||GHIDRA||||END| src/main/resources/images/PreviousSelectionBlock16.gif||GHIDRA||||END| +src/main/resources/images/ThunkFunction.dark.gif||GHIDRA||||END| src/main/resources/images/ThunkFunction.gif||GHIDRA||||END| src/main/resources/images/U.gif||GHIDRA||||END| src/main/resources/images/Unpackage.gif||GHIDRA||||END| @@ -748,6 +750,7 @@ src/main/resources/images/closedFolderGroup.png||Modified Nuvola Icons - LGPL 2. src/main/resources/images/closedFolderInView.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/closedFolderInvalid.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/closedFolderLabels.png||Modified Nuvola Icons - LGPL 2.1||||END| +src/main/resources/images/closedFolderNamespaces.dark.png||GHIDRA||||END| src/main/resources/images/closedFolderNamespaces.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/cloudbar.jpg||GHIDRA||reviewed||END| src/main/resources/images/cloudbarReversed.jpg||GHIDRA||reviewed||END| @@ -853,6 +856,7 @@ src/main/resources/images/openFolderFunctions.png||Modified Nuvola Icons - LGPL src/main/resources/images/openFolderGroup.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/openFolderInView.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/openFolderLabels.png||Modified Nuvola Icons - LGPL 2.1||||END| +src/main/resources/images/openFolderNamespaces.dark.png||GHIDRA||||END| src/main/resources/images/openFolderNamespaces.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/oxygen/16x16/application-pdf.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| src/main/resources/images/oxygen/16x16/application-x-bzip.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| diff --git a/Ghidra/Features/Base/data/base.icons.theme.properties b/Ghidra/Features/Base/data/base.icons.theme.properties index 0831ed28d8..19323dd601 100644 --- a/Ghidra/Features/Base/data/base.icons.theme.properties +++ b/Ghidra/Features/Base/data/base.icons.theme.properties @@ -399,3 +399,11 @@ icon.base.util.datatree.version.control.archive.dt.checkout.undo = vcUndoCheckOu [Dark Defaults] + + +icon.plugin.symboltree.node.function.thunk = ThunkFunction.dark.gif +icon.plugin.symboltree.node.namespace = Namespace.dark.gif +icon.plugin.symboltree.node.category.namespace.closed = closedFolderNamespaces.dark.png +icon.plugin.symboltree.node.category.namespace.open = openFolderNamespaces.dark.png + + diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java index 080dd5b998..2045cafd90 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusTableModel.java @@ -40,7 +40,7 @@ import ghidra.util.table.column.AbstractGColumnRenderer; import ghidra.util.table.column.GColumnRenderer; /** - * Model for {@link BundleStatus} objects. + * Model for {@link BundleStatus} objects. */ public class BundleStatusTableModel extends GDynamicColumnTableModel> { @@ -50,7 +50,7 @@ public class BundleStatusTableModel private static final Color COLOR_BUNDLE_DISABLED = new GColor("color.fg.table.bundle.disabled"); private static final Color COLOR_BUNDLE_BUSY = new GColor("color.fg.table.bundle.busy"); private static final Color COLOR_BUNDLE_INACTIVE = new GColor("color.fg.table.bundle.inactive"); - private static final Color COLOR_BUNDLE_ACTIVE = new GColor("color.fg.table.bundle.active"); + private static final Color COLOR_BUNDLE_ACTIVE = new GColor("color.fg.table.bundle.active"); //@formatter:on private BundleHost bundleHost; @@ -226,7 +226,7 @@ public class BundleStatusTableModel } /** - * return the row objects corresponding an array of model row indices. + * return the row objects corresponding an array of model row indices. * * @param modelRowIndices row indices * @return status objects @@ -240,7 +240,7 @@ public class BundleStatusTableModel } /** - * overridden to avoid generating events when nothing changed + * overridden to avoid generating events when nothing changed */ @Override protected void sort(List data, TableSortingContext sortingContext) { @@ -278,7 +278,7 @@ public class BundleStatusTableModel } } - /** + /** * (re)compute cached mapping from bundleloc to bundlepath * *

only used in testing @@ -560,20 +560,24 @@ public class BundleStatusTableModel GhidraBundle bundle = bundleHost.getGhidraBundle(file); if (bundle == null || bundle instanceof GhidraPlaceholderBundle || !file.exists()) { label.setForeground(COLOR_BUNDLE_ERROR); + return label; + } + + if (data.isSelected()) { + return label; // use default selection colors + } + + if (status.isBusy()) { + label.setForeground(COLOR_BUNDLE_BUSY); + } + else if (!status.isEnabled()) { + label.setForeground(COLOR_BUNDLE_DISABLED); + } + else if (status.isActive()) { + label.setForeground(COLOR_BUNDLE_ACTIVE); } else { - if (status.isBusy()) { - label.setForeground(COLOR_BUNDLE_BUSY); - } - else if (!status.isEnabled()) { - label.setForeground(COLOR_BUNDLE_DISABLED); - } - else if (status.isActive()) { - label.setForeground(COLOR_BUNDLE_ACTIVE); - } - else { - label.setForeground(COLOR_BUNDLE_INACTIVE); - } + label.setForeground(COLOR_BUNDLE_INACTIVE); } return label; diff --git a/Ghidra/Features/Base/src/main/resources/images/FunctionScope.gif b/Ghidra/Features/Base/src/main/resources/images/FunctionScope.gif index 28263f36bf0a918b15b35ea7924c08bd0941f930..d422c27577340ea41e381d667e067afc478b95b0 100644 GIT binary patch literal 112 zcmZ?wbhEHb6krfwIK;y6pW*+RGiPQ30mIDyNI>zQpmR}bVo7R>LV0FMhJw4NZvcbh zPZmZl1||j_1|R?#z`(4avFpyi35)_ycZ4=hy#DU8TWUCG(cBM9UvuVZNG>m#%D`X^ E0Q6NZ!vFvP literal 98 zcmZ?wbhEHb6krfwSj58cpW*+RGiPQ30mIDy|Nk?jEB+I7E=o--Nlj5G&n(GMaQE~LU{L(Y!pOzI$e;sK u1X9kxq|np9^7Pw!27^skEv_$(eET6WuDxbqN1y7>ZD&fIHU%*-SOWkf7av;y literal 79 zcmZ?wbhEHb6krfwn8?Jy!0;c0|AR=ypDc_F3``6Abyv#_I2b?3G-rB0iI7#OSpG5#3a diff --git a/Ghidra/Features/Base/src/main/resources/images/ThunkFunction.dark.gif b/Ghidra/Features/Base/src/main/resources/images/ThunkFunction.dark.gif new file mode 100644 index 0000000000000000000000000000000000000000..32f8d4db32f2223e63e8b39d83154396f7380e87 GIT binary patch literal 124 zcmZ?wbhEHb6krfwIK;y6pW*+RGiPQ30mIDy|Nk>EFaSv)Q2Zz8T$GwvlA5AWo>`Ki z;O^-gz@Ye(g^`Paok0hv45(dzfq_}4V&m%XA51M5Z{cQm{X$CN7$bAK+!M*nC(G;- Y{@A_rnQqo~`|IjfvxGbgZw3Zy03W+Bo&W#< literal 0 HcmV?d00001 diff --git a/Ghidra/Features/Base/src/main/resources/images/ThunkFunction.gif b/Ghidra/Features/Base/src/main/resources/images/ThunkFunction.gif index 4ba126852675e144d91c4bd3882fcb801940de42..72f00ddaf51cdd17411a9789368e4f2563ad9ad2 100644 GIT binary patch literal 124 zcmZ?wbhEHb6krfwIK;y6pW*+RGiPQ30mIDy|Nk>EFaSv)Q2Zz8T$GwvlA5AWo>`Ki z;O^-gz@Ye(g^`Paok0hv45(dzfq_}4V(aSfA51M5Z{cQm{X$CN7$bAK+!M*nC(G;- Y{@A_rnQqo~`|IjfvxGbgZw3Zy03dHLq5uE@ literal 118 zcmZ?wbhEHb6krfwSj52apW*+RGiPQ30mIDy|Nk?&4sc@9nqWHQLOE3#vQS+jFQdHVc!EjPI}1ckb{BpY}h>Fj8l MT;!#y!oXk+0AlPVxc~qF diff --git a/Ghidra/Features/Base/src/main/resources/images/closedFolderNamespaces.dark.png b/Ghidra/Features/Base/src/main/resources/images/closedFolderNamespaces.dark.png new file mode 100644 index 0000000000000000000000000000000000000000..a8c8611784a24c90a030f72cfc92a6e2eed22f4a GIT binary patch literal 608 zcmV-m0-ybfP)P000pP1^@s6D7ps@00006VoOIv0RI60 z0RN!9r;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gLDNUfh@!73kOnq{=e)S^Sv(auAqqZ@s zxO4P2TEmOiY2uGFQ;9_4b`@w}^p=#;RLN>R$*kv@PM7`C<#)?#JdE+cD2(waS9a`5 zsnw2-j)gklX298Bp*@%BbeY)sFhf_)VN?O5@@OxM_VRnOnNF99kJ;~mx%v5duMR6* zr?)k{`1qLJnHY|&OwKyM=i_XOAHc_vk&#T*P^nZLDP;)Ii;Igr-QC>{3o-ERY7gzP`S|=;&y5g|zxBqXaNHIoTSE#Y)z`joj=L{z(*20ld1AJq0uiA=dnR hyYDa7@34O=zX2A3f-j Date: Wed, 24 Apr 2024 09:00:22 -0400 Subject: [PATCH 2/2] Updated an enum to be public so it is usable from a script --- .../core/decompile/actions/PCodeCfgGraphTask.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/PCodeCfgGraphTask.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/PCodeCfgGraphTask.java index 4de761dd07..4518157bfa 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/PCodeCfgGraphTask.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/PCodeCfgGraphTask.java @@ -40,7 +40,7 @@ import ghidra.util.task.TaskMonitor; * Task to create a PCode control flow graph based on decompiler output */ public class PCodeCfgGraphTask extends Task { - enum PcodeGraphSubType { + public enum PcodeGraphSubType { CONTROL_FLOW_GRAPH("AST Control Flow"), DATA_FLOW_GRAPH("AST Data Flow"); private String name; @@ -95,8 +95,7 @@ public class PCodeCfgGraphTask extends Task { createControlFlowGraph(graph, monitor); } - GraphDisplay display = - graphService.getDefaultGraphDisplay(!newGraph, monitor); + GraphDisplay display = graphService.getDefaultGraphDisplay(!newGraph, monitor); PCodeCfgDisplayListener displayListener = new PCodeCfgDisplayListener(tool, display, hfunction, pcodeGraphType); @@ -270,10 +269,9 @@ public class PCodeCfgGraphTask extends Task { protected void createControlFlowGraph(AttributedGraph graph, TaskMonitor monitor) throws CancelledException { - Iterator pblockIter = hfunction.getBasicBlocks().iterator(); - while (pblockIter.hasNext()) { + for (PcodeBlockBasic element : hfunction.getBasicBlocks()) { monitor.checkCancelled(); - graphPcodeBlock(graph, pblockIter.next(), monitor); + graphPcodeBlock(graph, element, monitor); } }