diff --git a/data/languages/RPX.opinion b/data/languages/RPX.opinion index e7bdf04..5ec29b7 100644 --- a/data/languages/RPX.opinion +++ b/data/languages/RPX.opinion @@ -1,5 +1,6 @@ - - - + + + + diff --git a/src/main/java/ghidra/app/util/opinion/CafeLoader.java b/src/main/java/ghidra/app/util/opinion/CafeLoader.java index 66a95f6..0f032ad 100644 --- a/src/main/java/ghidra/app/util/opinion/CafeLoader.java +++ b/src/main/java/ghidra/app/util/opinion/CafeLoader.java @@ -28,8 +28,26 @@ public class CafeLoader extends ElfLoader { List loadSpecs = new ArrayList<>(); if (Arrays.equals(provider.readBytes(0, header.length), header)) { - loadSpecs.add(new LoadSpec(this, 0, new LanguageCompilerSpecPair("PowerPC:BE:32:Gekko_Broadway", "default"), true)); - return loadSpecs; + List results = QueryOpinionService.query(getName(), "wiiu", null); + boolean hasGekkoProcessor = false; + + for (QueryResult result : results) { + if (result.pair.languageID.getIdAsString().contains("Gekko")) { + hasGekkoProcessor = true; + } + } + + for (QueryResult result : results) { + if (result.pair.languageID.getIdAsString().contains("Gekko")) { + loadSpecs.add(new LoadSpec(this, 0, new QueryResult(result.pair, true))); + } else { + loadSpecs.add(new LoadSpec(this, 0, new QueryResult(result.pair, hasGekkoProcessor ? false : result.preferred))); + } + } + + if (loadSpecs.isEmpty()) { + loadSpecs.add(new LoadSpec(this, 0, new LanguageCompilerSpecPair("PowerPC:BE:32:default", "default"), true)); + } } return loadSpecs;