mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-02-20 02:07:02 +03:00
Miscellaneous Ghidra script tweaks
No behavioural changes.
This commit is contained in:
parent
c020c2e247
commit
3c4f0e72b8
3 changed files with 15 additions and 13 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import ghidra.app.script.GhidraScript;
|
import ghidra.app.script.GhidraScript;
|
||||||
import ghidra.app.services.DataTypeQueryService;
|
import ghidra.app.services.DataTypeQueryService;
|
||||||
|
import ghidra.app.util.NamespaceUtils;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.data.ArrayDataType;
|
import ghidra.program.model.data.ArrayDataType;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
|
|
@ -86,16 +87,17 @@ public class EnhancedImport extends GhidraScript{
|
||||||
/* Creates namespaces from the given name, returning the deepest one
|
/* Creates namespaces from the given name, returning the deepest one
|
||||||
Returns null if the qualified name is in the global namespace.
|
Returns null if the qualified name is in the global namespace.
|
||||||
*/
|
*/
|
||||||
final String[] parts = qualifiedName.split("::");
|
return qualifiedName.contains("::") ?
|
||||||
|
NamespaceUtils.createNamespaceHierarchy(
|
||||||
if (parts.length < 2) return null;
|
qualifiedName.substring( // Cut off symbol name
|
||||||
|
0,
|
||||||
final String[] names = Arrays.copyOfRange(parts, 0, parts.length - 1);
|
qualifiedName.length() - "::".length() -
|
||||||
|
unqualified(qualifiedName).length()
|
||||||
Namespace ns = null;
|
),
|
||||||
for (final String name : names) ns = createNamespace(ns, name);
|
null,
|
||||||
|
currentProgram,
|
||||||
return ns;
|
SourceType.USER_DEFINED
|
||||||
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<DataType> makeType(final String type) throws Exception {
|
private Optional<DataType> makeType(final String type) throws Exception {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue